package com.octopus.samples.xici;

import com.octopus.core.Response;
import com.octopus.core.collector.Collector;
import com.octopus.core.result.Result;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * 代理服务器数据收集
 *
 * @author shoulai.yang@gmail.com
 * @date 2019/08/06
 */
public class XiciProxyCollector implements Collector {

  private List<XiciProxy> proxies = new CopyOnWriteArrayList<>();

  @Override
  public void collect(Result result, Response response) {
    List<XiciProxy> list = result.obj();
    proxies.addAll(list);
  }

  public List<XiciProxy> getProxies() {
    return proxies;
  }
}
